import java.util.Scanner;

import java.util.*;
//小美走公路


public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n=in.nextInt();
        ArrayList<Long> arr=new ArrayList<>();//n个站的各个路程
        arr.add(0L);
        for(int i=1;i<n+1;i++){
            arr.add(in.nextLong());
        }
        int start=in.nextInt();
        int end=in.nextInt();
        //如果往回走(数大的站到数小的站)就交换一下，方便下面的循环。
        //因为下面的循环是从start开始的,要保证start是小的一方
        if(start>end){
            int temp=start;
            start=end;
            end=temp;
        }
        long clockWise=0;//顺时针
        long anticlockwise=0;//逆时针
        for(int i=start;i<end;i++){
            clockWise+=arr.get(i);
        }
        for(int i=1;i<n+1;i++){
            if(i>=start&&i<end){
                continue;
            }
            anticlockwise+=arr.get(i);
        }
        long res=clockWise>anticlockwise?anticlockwise:clockWise;
        System.out.print(res);
    }

    //小美的蛋糕切割
    public static void main1(String[] args) {
        Scanner sc = new Scanner(System.in);
        long ans = (long)9e18;
        int n = sc.nextInt(), m = sc.nextInt();
        long[][] a = new long[n+5][m+5];
        long[][] b = new long[n+5][m+5];
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= m; j++) {
                a[i][j] = sc.nextInt();
            }
        }
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= m; j++) {
                b[i][j] = b[i-1][j] + b[i][j-1] - b[i-1][j-1] + a[i][j];
            }
        }
        for (int i = 1; i <= n; i++) {
            ans = Math.min(ans, Math.abs(b[i][m] * 2 - b[n][m]));
        }
        for (int j = 1; j <= m; j++) {
            ans = Math.min(ans, Math.abs(b[n][j] * 2 - b[n][m]));
        }
        System.out.print(ans);
    }
}